package com.ruifu.common.feign;

import com.fhzncloud.cloud.common.core.constant.SecurityConstants;
import com.ruifu.common.constant.BizServiceNameConstants;
import com.ruifu.common.feign.factory.RemoteWsServiceFallbackFactory;
import com.ruifu.common.vo.ResultVO;
import com.ruifu.common.vo.worksheet.WsCommonSheet;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.math.BigInteger;

@FeignClient(contextId = "remoteWorkSheetService", value = BizServiceNameConstants.WORKSHEET_SERVICE, fallbackFactory = RemoteWsServiceFallbackFactory.class)
public interface RemoteWorkSheetService {
    /**
     * 任务待办
     *
     * @param cmId 工作单ID
     * @param classFlag 工作单Feign表标识号 问题报告单:pes  作废通知单:vns 变更申请单:crs 变更通知单:cns
     * @return WsCommonSheetVO 工作单数据
     */
    @GetMapping(value = "/feignWorkSheet/feignFindWsById/{cmId}/{classFlag}")
    WsCommonSheet feignFindWsById(@PathVariable("cmId") BigInteger cmId,
                                  @PathVariable("classFlag") String classFlag);

    /**
     * 流程审批操作
     *
     * @param cmId 工作单ID
     * @param classFlag 工作单Feign表标识号 问题报告单:pes  作废通知单:vns 变更申请单:crs 变更通知单:cns
     * @isEnd 是否最后一步流程节点操作 false:否 true:是
     */
    @GetMapping(value = "/feignWorkSheet/feignReviewCommit/{cmId}/{classFlag}/{isEnd}")
    void feignReviewCommit(@PathVariable("cmId") BigInteger cmId,
                                      @PathVariable("classFlag") String classFlag,
                                      @PathVariable("isEnd") Boolean isEnd);

    /**
     * 账套号数据同步
     *
     * @param sourceSetId  源
     * @param targetSetId  目标
     * @return boolean true:success,false:fail
     */
    @GetMapping(value = "/feignWorkSheet/feignSynchroData/{sourceSetId}/{targetSetId}")
    boolean feignSynchroData(@PathVariable("sourceSetId") Long sourceSetId,
                             @PathVariable("targetSetId") Long targetSetId,
                             @RequestHeader(SecurityConstants.FROM) String from);
}
